﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BGM_Project_Expense_New.aspx.cs" Inherits="KPIS.GERP.GBMS.APP_UI.Form.BGM_Project_Expense_New" %>

<%@ Register src="../UserControls/Bgm_Project_Expense_Detail.ascx" tagname="Bgm_Project_Expense_Detail" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=9" />
    <title><asp:Literal runat="Server" id="litTitle"/></title>
</head>
<body>
    <form id="form1" runat="server">
        <link rel="StyleSheet" href="../../Styles/StyleSheet.css" type="text/css">
        
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager> 
        
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" > 
        </telerik:RadAjaxLoadingPanel>

        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> <%--OnAjaxRequest="RadAjaxManager1_AjaxRequest"--%>
            <AjaxSettings>
            
                <%--<telerik:AjaxSetting AjaxControlID="ALL">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ALL" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>--%>
            
                <telerik:AjaxSetting AjaxControlID="rdShowSelected">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="gridExpense" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="rdShowAll" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="rdShowSelected" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="rdShowAll">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="gridExpense" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="rdShowSelected" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="rdShowAll" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="rblBgmExpGrpSeq">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rblBgmExpGrpSeq" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="gridExpense" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="gridExpense">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="gridExpense" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="gridExpense" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="rblBgmExpGrpSeq" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <%--<telerik:AjaxSetting AjaxControlID="ExpenseDetail">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ExpenseDetail" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="gridExpense" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>--%>
            </AjaxSettings>
        </telerik:RadAjaxManager>
                
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                function onTextChange(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                }

                function closeRadWindow() {
                    var RadAjaxManager1 = $find('<%= RadAjaxManager1.ClientID %>');
                    RadAjaxManager1.ajaxRequest();
                }
                
                function OpenRadWindow(value) {
                    radopen("BGM_Project_Expense_Detail.aspx?args=" + value, "ExpenseDetail");
                }
            </script>
        </telerik:RadCodeBlock>
<telerik:RadWindowManager ID="RadWindowManager2" ShowContentDuringLoad="false" 
    VisibleStatusbar="false" ReloadOnShow="true" runat="server" Skin="Web20" 
    Modal="true" KeepInScreenBounds="true" Style="z-index: 10001">
    <Windows>
        <telerik:RadWindow ID="ExpenseDetail" runat="server" Width="700px" Height="410px"
            Behaviors="Reload, Close" OnClientClose="closeRadWindow" >
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
<asp:Panel ID="ALL" runat="server">
    <div style="padding: 10px">
        <div class="defaultFont">
            <table cellpadding="0" cellspacing="0" width="800px"  class="defaultTable" >
                <tr>
                    <td>
                        <table cellpadding="0" cellspacing="0" width="800px" class="defaultTable" >
                            <tr>
                                <td width="50%">
                                    <span style="color: #FF0000;">*** กรอกข้อมูลในช่องค้นหา เพื่อความสะดวกในการหาค่าใช้จ่าย ***</span>
                                </td>
                                <td>
                                    <table>
                                        <tr>
                                            <td>
                                                <asp:RadioButton ID="rdShowSelected" runat="server" 
                                                    Text="แสดงเฉพาะรายการค่าใช้จ่ายที่เลือก" Checked="true" AutoPostBack="True" 
                                                    OnCheckedChanged="rdShowSelected_CheckedChanged"
                                                    ForeColor="OrangeRed" />
                                            </td>
                                            <td>
                                                <asp:RadioButton ID="rdShowAll" runat="server" 
                                                    Text="แสดงรายการค่าใช้จ่ายทั้งหมด" AutoPostBack="True" 
                                                    OnCheckedChanged="rdShowAll_CheckedChanged" />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" style="border-bottom-style: solid; border-bottom-width: 1px">
                                </td>
                            </tr>
                            <tr>
                                <td align="center" colspan="2">
                                    <asp:RadioButtonList ID="rblBgmExpGrpSeq" runat="server" RepeatDirection="Horizontal"
                                        DataTextField="Name" DataValueField="Sequence" AutoPostBack="true"
                                        OnSelectedIndexChanged="rblBgmExpGrpSeq_SelectedIndexChanged">
                                    </asp:RadioButtonList>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Panel ID="pnGridExpense" runat="server" >
                            <asp:Label ID="lbProjectID" runat="server" Visible="false"></asp:Label>
                            <asp:Label ID="lbSourceSeq" runat="server" Visible="false"></asp:Label>
                            <asp:Label ID="lbSourceName" runat="server" Visible="false"></asp:Label>
                            <table cellpadding="0" cellspacing="0" class="defaultTable" width="100%">
                                <tr>
                                    <td>
                                        <table cellpadding="0" cellspacing="0" class="defaultTable">
                                            <tr>
                                                <td style="padding-top: 20px; padding-left: 10px;">
                                                    <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="gridExpense" runat="server" AllowFilteringByColumn="True" 
                                                        AllowMultiRowSelection="false" AutoGenerateColumns="False" Font-Names="Segoe UI" 
                                                        Font-Size="13px" GridLines="None" MasterTableView-GridLines="None" 
                                                        OnItemCommand="gridExpense_ItemCommand" 
                                                        OnItemDataBound="gridExpense_ItemDataBound"
                                                        Width="820px"
                                                        Height="360px">
                                                        <mastertableview CommandItemDisplay="None" DataKeyNames="value" 
                                                            GroupLoadMode="Client"
                                                            NoDetailRecordsText="... ไม่มีข้อมูล ..." width="100%"><%----%>
                                                            <Columns>
                                                                <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                                                    CurrentFilterFunction="Contains" DataField="text" FilterControlWidth="100%" 
                                                                    HeaderStyle-HorizontalAlign="Center" HeaderText="ค่าใช้จ่าย" 
                                                                    ShowFilterIcon="false" UniqueName="text"
                                                                    ItemStyle-Width="500px">
                                                                    <HeaderStyle HorizontalAlign="Center" />
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridBoundColumn HeaderStyle-HorizontalAlign="Center" 
                                                                    HeaderText="รหัสค่าใช้จ่าย" ItemStyle-HorizontalAlign="Left" visible="false"
                                                                    UniqueName="value" DataField="value">
                                                                    <HeaderStyle HorizontalAlign="Center" />
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" 
                                                                    HeaderText="รายละเอียด" ItemStyle-HorizontalAlign="Left"
                                                                    UniqueName="descr"
                                                                    ItemStyle-Width="150px" ShowFilterIcon="false"
                                                                    FilterControlWidth="100%" >
                                                                    <HeaderStyle HorizontalAlign="Center" />
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lbDescr" runat="server"
                                                                            Text='<%# Eval("descr").ToString().Replace("\r\n", "<br />") %>' />
                                                                    </ItemTemplate>
                                                                </telerik:GridTemplateColumn>
                                                                <telerik:GridTemplateColumn AllowFiltering="false"
                                                                    UniqueName="total_amount" 
                                                                    HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="100px" 
                                                                    HeaderText="จำนวนเงิน(บาท)" ItemStyle-HorizontalAlign="Right" 
                                                                    ItemStyle-Width="80px" ShowFilterIcon="false">
                                                                    <HeaderStyle HorizontalAlign="Center" />
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lbTotalAmount" runat="server"
                                                                            ForeColor="Blue" Text='<%# Eval("total_amount", "{0:n2}") %>' />
                                                                    </ItemTemplate>
                                                                </telerik:GridTemplateColumn>
                                                                <telerik:GridTemplateColumn AllowFiltering="false" visible="true">
                                                                    <HeaderStyle Width="40px" />
                                                                    <ItemStyle Height="40px" HorizontalAlign="Center" />
                                                                    <ItemTemplate>
                                                                        <asp:ImageButton ID="DetailControl" runat="server" CommandName="Dtls"
                                                                            AlternateText="แสดงรายละเอียด" BorderWidth="0px" 
                                                                            ImageUrl="../Image/Grid/Magnifier.gif" Style="float: right; cursor: pointer;"
                                                                             />
                                                                    </ItemTemplate>
                                                                </telerik:GridTemplateColumn>
                                                                <telerik:GridBoundColumn HeaderStyle-HorizontalAlign="Center" 
                                                                    HeaderText="รหัสค่าใช้จ่าย" ItemStyle-HorizontalAlign="Left" 
                                                                    DataField="bgm_proj_exp_seq"
                                                                    UniqueName="bgm_proj_exp_seq" visible="false">
                                                                    <HeaderStyle HorizontalAlign="Center" />
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridBoundColumn AutoPostBackOnFilter="true" 
                                                                    CurrentFilterFunction="Contains" DataField="bgm_exp_grp_x" 
                                                                    FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" 
                                                                    HeaderText="ลักษณะการเบิกจ่าย" ShowFilterIcon="false" 
                                                                    UniqueName="bgm_exp_grp_x" Visible="false">
                                                                    <HeaderStyle HorizontalAlign="Center" />
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridBoundColumn DataField="icm_res_item_seq"
                                                                    UniqueName="icm_res_item_seq" Visible="false">
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridBoundColumn DataField="unit_price"
                                                                    UniqueName="unit_price" Visible="false">
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridBoundColumn DataField="unit_qty"
                                                                    UniqueName="unit_qty" Visible="false">
                                                                </telerik:GridBoundColumn>
                                                                <telerik:GridBoundColumn DataField="bgm_source_seq"
                                                                    UniqueName="bgm_source_seq" Visible="false">
                                                                </telerik:GridBoundColumn>
                                                            </Columns>
                                                            <groupbyexpressions>
                                                                <telerik:GridGroupByExpression>
                                                                    <groupbyfields>
                                                                        <telerik:GridGroupByField FieldName="bgm_exp_seq_2" HeaderText="" />
                                                                    </groupbyfields>
                                                                    <selectfields>
                                                                        <telerik:GridGroupByField FieldName="bgm_exp_name_2" 
                                                                            HeaderText="หมวดค่าใช้จ่าย : " HeaderValueSeparator="" />
                                                                    </selectfields>
                                                                </telerik:GridGroupByExpression>
                                                                <telerik:GridGroupByExpression>
                                                                    <groupbyfields>
                                                                        <telerik:GridGroupByField FieldName="bgm_exp_seq_1" HeaderText="" />
                                                                    </groupbyfields>
                                                                    <selectfields>
                                                                        <telerik:GridGroupByField FieldName="bgm_exp_name_1" 
                                                                            HeaderText="รายการรายจ่าย : " HeaderValueSeparator="" />
                                                                    </selectfields>
                                                                </telerik:GridGroupByExpression>
                                                            </groupbyexpressions>
                                                        </mastertableview>
                                                        <clientsettings EnableRowHoverStyle="true" >
                                                            <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                                                            <selecting allowrowselect="false" />
                                                        </clientsettings>
                                                    </telerik:RadGrid>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </td>
                </tr>
            </table>
        </div>
        </div>
    <%--</div>
</div>--%>
<%--<asp:Panel ID="PanelOpacity" runat="server" CssClass="Opacity" Visible="false">
</asp:Panel>
<asp:Panel ID="PanelPopUp" runat="server" CssClass="PanelAbsolute" Visible="false">
    <uc1:Bgm_Project_Expense_Detail ID="Bgm_Project_Expense_Detail1" runat="server" />
</asp:Panel>--%>
</asp:Panel>
</form>
</body>
</html>
